package  
{
	import org.flixel.FlxG;
	/**
	 * ...
	 * @author morgan
	 */
	public class BulletPattern
	{
		public var pattern:Array;
		public function BulletPattern() 
		{
			pattern = new Array();
		}
		
		public function updateBehaviors(lastFrameTime:Number, thisFrameTime:Number, b:Bullet):void
		{
			for (var i:int = 0; i < pattern.length; i++ )
			{
				var start_end_behavior:Array = pattern[i];
				if (lastFrameTime < start_end_behavior[0] && thisFrameTime >= start_end_behavior[0])
				{
					start_end_behavior[2].onActivate(b);
				}
				if (thisFrameTime >= start_end_behavior[0] && thisFrameTime < start_end_behavior[1])
				{
					start_end_behavior[2].onUpdate(b);
				}
				if (lastFrameTime < start_end_behavior[1] && thisFrameTime >= start_end_behavior[1])
				{
					start_end_behavior[2].onEnd(b);
				}

			}
		}		
		
		public function addBehavior(bb:BulletBehavior, start:Number = 0, end:Number = Number.MAX_VALUE):void
		{
			pattern.push([start, end, bb]);
		}
		
	}

}